﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Function;

namespace UI.UserControl.Base
{
    public class DMLButtonEntity : System.Web.UI.UserControl
    {
        #region properties
        private string _buttons = "add;query";
        /// <summary>
        /// 按钮 add 新增 query 查询 多个以分号分隔
        /// </summary>
        public string Buttons { internal protected get { return _buttons; } set { _buttons = value; } }

        private string _title = "列表";
        /// <summary>
        /// 标题列表
        /// </summary>
        public string Title { get { return _title; } set { _title = value; } }

        private string _relativePathDepth = Method.RelativePathDepth;
        /// <summary>
        /// 相对深度 默认为根目录至第三级
        /// </summary>
        public string RelativePathDepth { get { return _relativePathDepth; } set { _relativePathDepth = value; } }

        private string _addPage = "Add.aspx";
        /// <summary>
        /// 新增页面 默认Add.aspx
        /// </summary>
        public string AddPage { internal protected get { return AutoAppendModuleId ? _addPage += "?mid=" + (Request.QueryString["mid"] ?? "") : _addPage; } set { _addPage = value; } }

        private string _queryPage = "Query.aspx";
        /// <summary>
        /// 查询页面 默认Query.aspx
        /// </summary>
        public string QueryPage { internal protected get { return AutoAppendModuleId ? _queryPage += "?mid=" + (Request.QueryString["mid"] ?? "") : _queryPage; } set { _queryPage = value; } }

        private bool _autoAppendModuleId = true;
        /// <summary>
        /// 是否自动加上当前模块id
        /// </summary>
        public bool AutoAppendModuleId { get { return _autoAppendModuleId; } set { _autoAppendModuleId = value; } }
        #endregion

        #region 备用按钮
        private string _backupPage = "";
        /// <summary>
        /// 备用页面
        /// </summary>
        public string BackupPage { internal protected get { return AutoAppendModuleId ? _backupPage += "?mid=" + (Request.QueryString["mid"] ?? "") : _backupPage; } set { _backupPage = value; } }

        /// <summary>
        /// 备用按钮文本
        /// </summary>
        public string BackupButtonText { get; set; }

        private bool _backupButtonVisible = false;
        /// <summary>
        /// 备用按钮是否可见
        /// </summary>
        public bool BackupButtonVisible
        {
            get { return _backupButtonVisible; }
            set { _backupButtonVisible = value; }
        }

        #endregion
    }
}
